data <- read.csv("./Data/def1816.csv")
set.seed(1)

coef.boot <- NULL
for(i in 1:200){
	sampi <- sample(unique(data$t),length(unique(data$t)),rep=T)
	indi <- NULL
	for(j in 1:length(sampi)){
		indi <- c(indi,which(data$t==sampi[j]))
	}
	datai <- data[indi,]
	esti <- glm(y~kstar2+gwesp+midhistt+coment+threatt+contigt+jntdemt+demdift+majpowt+dydistt,data=datai,family=binomial)
	coef.boot <- rbind(coef.boot,rbind(coef(esti)))
	print(i)
}
write.csv(data.frame(coef.boot),"./Data/def1816res1.csv")



		
